import React, { Component } from "react";
// 用于做props的类型检查
// import PropTypes from "prop-types";
import { number, string } from "prop-types";

const Child1 = (props) => {
  return <div>child1组件 - {props.msg}</div>;
};
Child1.propTypes = {
  msg: string,
};

class Child2 extends Component {
  static propTypes = {
    count: number,
  };
  render() {
    return <div>child2组件 - {this.props.count}</div>;
  }
}
// Child2.propTypes = {
//   count: number,
// };

class App extends Component {
  render() {
    return (
      <>
        <h2>props</h2>
        <Child1 msg="hello" />
        <Child2 count={10} />
      </>
    );
  }
}

export default App;
